home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 039a / mawk10.zip / MAWK_TES.T < prev    next >
Text File  |  1991-10-05  |  2KB  |  109 lines

  1. #!/bin/sh
  2.  
  3. # This is a simple test that a new made mawk seems to
  4. # be working OK.
  5. # It's certainly not exhaustive, but the last two tests in 
  6. # particular use most features.
  7. #
  8. # It needs to be run from  mawk/test
  9. # and mawk needs to be in PATH 
  10. #
  11.  
  12. dat=mawk_test.dat
  13.  
  14. trap 'echo mawk_test failed ; rm -f temp$$ ; exit 1'  0
  15.  
  16. PATH=.:$PATH
  17.  
  18. # find out which mawk we're testing
  19. mawk -V
  20.  
  21.  
  22. #################################
  23. echo testing input and field splitting
  24. mawk -f wc.awk $dat > temp$$
  25.  
  26. ( cat | cmp -s  - temp$$ ) <<@@
  27. 107 479
  28. @@
  29.  
  30. [ $? = 0 ] || exit
  31.  
  32. echo input and field splitting OK
  33. #####################################
  34.  
  35. echo
  36. echo testing regular expression matching
  37. mawk -f reg0.awk $dat > temp$$
  38. mawk -f reg1.awk $dat >> temp$$
  39. mawk -f reg2.awk $dat >> temp$$
  40.  
  41. ( cat | cmp -s  - temp$$ ) <<@@
  42. 3
  43. 4
  44. 1
  45. @@
  46.  
  47. [ $? = 0 ] || exit
  48. echo regular expression matching OK
  49. #######################################
  50.  
  51. echo
  52. echo testing arrays and flow of control
  53. mawk -f wfrq0.awk $dat > temp$$
  54.  
  55. ( cat | cmp -s  - temp$$ ) <<@@
  56.  29 p
  57.  21 A
  58.  14 ANODE
  59.  13 q
  60.  12 d
  61.  12 sval
  62.  10 if
  63.  10 the
  64.   8 dlink
  65.   8 h
  66.   8 is
  67.   7 to
  68.   6 D
  69.   6 of
  70.   5 cflag
  71.   5 deleted
  72.   5 else
  73.   5 front
  74.   5 hash
  75.   5 link
  76. @@
  77.  
  78. [ $? = 0 ] || exit
  79. echo array test OK
  80. #################################
  81.  
  82. echo
  83. echo testing function calls and general stress test
  84. mawk -f ../examples/decl.awk $dat > temp$$
  85.  
  86. ( cat | cmp -s - temp$$ ) <<'@@'
  87. hash: function returning unsigned (extern)
  88. last_dhash: unsigned (static)
  89. A: ARRAY
  90. sval: pointer to STRING
  91. cflag: int
  92. A: ARRAY
  93. d: double
  94. cflag: int
  95. ap: pointer to ANODE
  96. signal: function returning pointer to function returning void
  97. @@
  98.  
  99. [ $? = 0 ] || exit
  100. echo general stress test passed
  101.  
  102.  
  103. echo
  104. echo  tested mawk seems OK
  105.  
  106. trap 0
  107. rm -f temp$$
  108. exit 0
  109.